<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
  	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  	<title>会员中心</title>
  	<link rel="stylesheet" href="/public/global/layui/css/layui.css">
  	<link rel="stylesheet" type="text/css" href="/public/user/style.css"/>
  	<script type="text/javascript" src="/public/global/jquery/1.11.1/jquery.min.js" ></script>
  	<script type="text/javascript" src="/public/global/layui/layui.js"></script>
</head>
	<body>
	<style>
		.header{
			background: #009688;
			float: left;
			width: 100%;
		}
		.header .layui-nav-child{
			z-index: 9999;
		}
		.left{
			float: left;
		}
		.right{
			float: right;
		}
	</style>
		<div class='header'>
		<div class="left">
			<div class="layui-nav layui-bg-green ">
				<ul>
					<li class="layui-nav-item" >
						<a href="{{WEBURL}}"  target="_blank">网站首页</a>
					</li>
					<foreach array='HOME_MENU'>
					<li class="layui-nav-item" >
						<a href="{{$row.link}}"  target="{{$row.target}}">{{$row.name}}</a>
						<if condition="$row['list']">
							<dl class="layui-nav-child">
							<foreach array="row['list']" value="_row">
								<dd>
									<a href="{{$_row['link']}}" style="color: {{$_row.color}};" target="{{$_row.target}}">{{$_row['name']}}</a>
								</dd>
							</foreach>
							</dl>
						</if>
					</li>
					</foreach>
				</ul>
			</div>
		</div>
		<div class="right">
			<div class="layui-nav layui-bg-green ">
				<ul>
					<li class="layui-nav-item">
						<a href="">控制台<span class="layui-badge">{{$smsnum}}</span></a>
					</li>
					
					<li class="layui-nav-item" lay-unselect="">
						<php>
							$thumb=C('MYDB.thumb') ? get_img_url(C('MYDB.thumb')) : "/public/global/images/face.jpg";
						</php>
						<a href="javascript:;"><img src="{{$thumb}}" class="layui-nav-img">{{C('MYDB.username')}}</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="/login/index/login_out">退出</a>
							</dd>
						</dl>
					</li>
				</ul>
			</div>
		</div>
	</div>
		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree layui-bg-green">
					<li class="layui-nav-item layui-nav-itemed">
						<a class="" href="javascript:;">基本功能</a>
						<dl class="layui-nav-child">
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/Myprofile/edit_my_profile" data-id="edit_my_profile">我的资料</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/sms/index" data-id="my_sms">我的站内信息</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/jifen/index" data-id="my_jifen">我的积分日志</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/renzheng/index" data-id="my_renzheng">身份认证</a></dd>
						</dl>
					</li>
					<li class="layui-nav-item layui-nav-itemed">
						<a class="" href="javascript:;">信息管理</a>
						<dl class="layui-nav-child">
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/articles/index" data-id="/user/articles/alllist">我发布的文章</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/articles/add" data-id="/user/articles/add">添加文章</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/comment/index" data-id="/user/comment/alllist">我的评论</a></dd>
						</dl>
					</li>
				
				<foreach array="Modular_DB">
					<li class="layui-nav-item  layui-nav-itemed">
						<a href="javascript:;">{{$row['name']}}</a>
						<dl class="layui-nav-child">
							<foreach array="row['rute']" key="_key" value="_row">
								<foreach array="_row" key="__key" value="name">
								<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/index/modular/{{$row['dir']}}/{{$_key}}/{{$__key}}" data-id="{{$row['dir']}}_{{$_key}}_{{$__key}}">{{$name}}</a></dd>
								</foreach>
							</foreach>
						</dl>
					</li>
				
				</foreach>
				<foreach array="pluginDB">
					<li class="layui-nav-item  layui-nav-itemed">
						<a href="javascript:;">{{$row['name']}}</a>
						<dl class="layui-nav-child">
							<foreach array="row['rute']" key="_key" value="_row">
								<foreach array="_row" key="__key" value="name">
								<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/index/plugin/{{$row['dir']}}/{{$_key}}/{{$__key}}" data-id="{{$row['dir']}}_{{$_key}}_{{$__key}}">{{$name}}</a></dd>
								</foreach>
							</foreach>
						</dl>
					</li>
				</foreach>
				</ul>	
			</div>
		</div>
		<php> 
			if($_GET['to']){ 
				$def="";
				$def1="";
			}else{
				$def="layui-this";
				$def1="layui-show";
			}
		</php>
		<div class="layui-body">
			<div class="layui-tab layui-side" lay-filter="Menu" lay-allowclose="true">
				<ul class="layui-tab-title">
				    <li class="{{$def}}" lay-id="setting_map" id="setting_map">控制面板</li>
					<if condition="$_GET['to']">
				    	<li class="layui-this" lay-id="to" id="{{NOWTIME}}">{{$_GET['name']}}</li>
				    </if>
				</ul>
				<div class="layui-tab-content">
				    <div class="layui-tab-item {{$def1}}"><iframe src="{{$maps}}"></iframe></div>
				    <if condition="$_GET['to']">
				    	<div class="layui-tab-item layui-show"><iframe src="{{urldecode($_GET['to'])}}"></iframe></div>
				   </if>
				</div>
			</div>
			
			
		    <!-- 内容主体区域 -->
		    
		</div>
		<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
	layui.use(['element'], function(){
		var $ = layui.jquery
		,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		var active = {
		    tabAdd: function(){
		    	var a=$(".layui-tab-title").children('li')
		    	for(i=0;i< a.length ;i++){
		    		if($(this).data('id')===a[i].getAttribute("lay-id")){
		    			document.getElementById('iframe_'+$(this).data('id')).src=$(this).data('url');
		    			element.tabChange('Menu', $(this).data('id')); //切换到：用户管理
		    			return false;
		    		}
		    	}
		      	//新增一个Tab项
			    element.tabAdd('Menu', {
			        title: this.innerHTML
			        ,content: '<iframe id="iframe_'+$(this).data('id')+'" src="'+$(this).data('url')+'"></iframe>'
			        ,id: $(this).data('id') //实际使用一般是规定好的id，这里以时间戳模拟下
			    })
		       	element.tabChange('Menu', $(this).data('id')); //切换到：用户管理
		       	//iframe自适应
			    $(window).on('resize', function () {
			        var content = $('.layui-side .layui-tab-content');
			        content.height($(this).height() - 140);
			        content.find('iframe').each(function () {
			            $(this).height(content.height());
			            //console.log(content.height());
			        });
			    }).resize();
		    }
		};
		$('.site-active').on('click', function(){
		    var othis = $(this);
		    active['tabAdd'] ? active['tabAdd'].call(this, othis) : '';
		});
		$('#setting_map i').hide();
		show_tab();
		function show_tab(){
			var content = $('.layui-side .layui-tab-content');
			content.height($(this).height() - 140);
			content.find('iframe').each(function () {
				$(this).height(content.height());
			});
		}
	});
	
</script>
	</body>
</html>
